package com.kefu.chat.vo;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.chat.model.ChatChannelExtModel;
import com.kefu.common.vo.AbstractSearchVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import java.util.Objects;

@Data
public class ChatChannelExtModelSearchVo extends AbstractSearchVo {
    @NotEmpty
    @ApiModelProperty(value = "渠道id")
    private String channelId;

    @ApiModelProperty(name = "extModelName", value = "拓展名")
    private String extModelName;

    @ApiModelProperty(name = "extModelType", value = "类型")
    private Integer extModelType;

    @Override
    public LambdaQueryWrapper<ChatChannelExtModel> lambdaQuery() {
        LambdaQueryWrapper<ChatChannelExtModel> wrapper = Wrappers.lambdaQuery(ChatChannelExtModel.class);
        wrapper.eq(ChatChannelExtModel::getChannelId, channelId);
        if (Objects.nonNull(extModelType)) {
            wrapper.eq(ChatChannelExtModel::getExtModelType, extModelType);
        }
        return wrapper;
    }
}
